<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>云影评</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body style='padding:10px'>
          
              

 
<form class="layui-form" lay-filter="example">
 
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>基础信息</legend>
</fieldset> 
  
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">版本号</label>
      <div class="layui-input-inline">
        <input type="text" name="xz_version" lay-verify="required" autocomplete="off" class="layui-input">
      </div>
    </div>
      <div class="layui-inline">
    <label class="layui-form-label">分支</label>
    <div class="layui-input-block">
      <input type="radio" name="xz_branch" value="develop" title="开发版" checked="" >
      <input type="radio" name="xz_branch" value="stable" title="稳定版" >
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">文件目录</label>
      <div class="layui-input-inline">
        <input type="text" name="src_path" lay-verify="required" autocomplete="off" class="layui-input">
      </div>
    </div>
      <div class="layui-inline">
    <label class="layui-form-label">类型</label>
    <div class="layui-input-block">
      <input type="radio" name="xz_realse" value="install" title="安装包" lay-filter="xz_realse_install" checked="">
      <input type="radio" name="xz_realse" value="upgrade" title="补丁包" lay-filter="xz_realse_upgrade">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">生成文件</label>
    <div class="layui-input-block">
      <span id='dofile' class="layui-input" style='line-height: 38px;color:#009900'></span>
    </div>
  </div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>更新日志</legend>
</fieldset> 
   <div class="layui-form-item layui-form-text">
    <div class="layui-input-block">
      <textarea name="xz_log" placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
  </div>
 <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>文件列表[对比GIT版本复制内容]</legend>
</fieldset> 
  <div class="layui-form-item layui-form-text">
    <div class="layui-input-block">
      <textarea name="xz_files" placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <button class="layui-btn submit layui-btn-fluid" lay-submit="" lay-filter="submit">生成补丁</button>
  </div>
</form>
          
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script type="text/javascript" src="data.json"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use(['form','jquery'], function(){
  var form = layui.form
  ,$ = layui.$
  ,layer = layui.layer;
  
 
  
  //监听提交
 form.on('submit(submit)', function(data){
  $('.submit').attr('disabled','disabled').text('正在生成...');
  $.post('wait.php',data.field,function(res){
    console.log(res);
    $('#dofile').text(res.file);
    $('.submit').removeAttr('disabled').text('生成补丁');
    layer.alert('补丁生成完成，请仔细检查生成内容，<br>务必充分测试后使用！'); 
    
  },'json')

    return false;
});
 
  //表单初始赋值
  form.val('example', _data);
  
form.on('radio(xz_realse_install)', function(data){
  $('input[name=src_path]').val('src/install')
}); 
  
form.on('radio(xz_realse_upgrade)', function(data){
  $('input[name=src_path]').val('src/upgrade')
});
});
</script>

</body>
</html>